/*
 * @Author: lduoduo
 * @Date: 2021-04-12 18:00:35
 * @Last Modified by: lduoduo
 * @Last Modified time: 2021-04-23 17:14:04
 * 该文件为流程节点的属性列表map表
 */
import {
  InputCode,
  InputName,
  InputDesc,
  InputAssignee,
  InputSkipExpression,
  InputSingleCheck,
  InputFormSelect,
  InputFormAuth,
  InputConditionExpression,
  InputDefaultCondition,
} from './inputs';

export const Process = [
  { ...InputName, title: '流程名称' },
  { ...InputCode, title: '流程id' },
  { ...InputDesc, title: '流程描述' },
  InputAssignee,
  InputSingleCheck,
];

export const Task = [InputName, InputCode, InputSkipExpression, InputAssignee];

export const DefaultEvent = [InputName, InputCode, InputDesc];

const InputsMap = {
  Process,
  StartEvent: [...DefaultEvent, InputFormSelect],
  EndEvent: DefaultEvent,
  Task,
  UserTask: [...DefaultEvent, InputFormSelect, InputFormAuth],
  SequenceFlow: [...DefaultEvent, InputDefaultCondition, InputConditionExpression]
};

export const getInputs = (str) => {
  if (!str) return [];
  const type = str.replace('bpmn:', '');

  return InputsMap[type] || DefaultEvent;
};

export default InputsMap;
